<?php
// contact to database
$connect = mysql_connect("localhost", "root", "") or die ("Error , check your server connection.");
mysql_select_db("stms");

$attend=mysql_query("SELECT * FROM attendence");
if (!$attend) {
        die('Invalid query: ' . mysql_error());
    }

if (mysql_num_rows($attend) == 1)
			{
				echo '<table border="1">';
				echo "<tr>";
				echo "<td>SUBJECTCODE</th>";
				echo "<th>DATE</th>";
				echo "<th>TIME</th>";
				echo "<th>NOOFPRESENT</th>";

				while($row=mysql_fetch_array($attend))
			{
				echo "<tr><td>".$row['Date'];
				echo "<td>".$row['Time'];
				echo "<td>".$row['SubjectCode'];
				echo "<td>".$row['Noofpresent'];


			}
			echo "</table>";

?>